home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl5
- #
- # rsvp-config.frm
- #
- # Copyright 1988-1996 Silicon Graphics, Inc.
- # All rights reserved.
- #
- # This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- # the contents of this file may not be disclosed to third parties, copied or
- # duplicated in any form, in whole or in part, without the prior written
- # permission of Silicon Graphics, Inc.
- #
- # RESTRICTED RIGHTS LEGEND:
- # Use, duplication or disclosure by the Government is subject to restrictions
- # as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- # and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- # successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- # rights reserved under the Copyright Laws of the United States.
- #
- # $Id: rsvp-config.frm,v 1.2 1997/11/17 19:10:19 shotes Exp $
-
- BEGIN { require "/usr/WebFace/lib/CGI.pm"; import CGI; }
- require "/usr/OnRamp/lib/OnRamp.pm";
- require "/usr/OnRamp/lib/java.pm";
- require "flush.pl";
-
- $config = "/etc/config/rsvpd.options";
- $log_err = "Log errors only";
- $title = "RSVP Configuration";
- $help_page = "rsvp-config-help.html";
-
- $query = new CGI;
-
- if ($ENV{'HTTP_USER_AGENT'} =~ /Mozilla\/2/) { $br_index = 1; }
- else { $br_index = 0; }
-
- $js =
- "br_index = $br_index;
- $js_standard
- $js_error_box
- $js_help
- function checkForm(form) {
- return (true);
- }";
-
- print $query->header;
- &js_title_block($title, $js);
-
- $help = $document_root . $ENV{"SCRIPT_NAME"};
- $help =~ s/cgi$/hlp/;
- exec $help if ($query->param('help') eq "Help");
-
- $chkconfig = system("/sbin/chkconfig", "rsvpd");
- # This seems backwards, but it works. Weird.
- if ($chkconfig) {
- $Ersvp = 'No';
- } else {
- $Ersvp = 'Yes';
- }
-
- if ($query->param('doit') eq 'Ok') {
- $new_level = $query->param('log_level');
-
- if ($new_level ne $log_err) {
- $log_level = 3 if ($new_level eq 'Log errors only');
- $log_level = 4 if ($new_level eq 'Also log warnings');
- $log_level = 6 if ($new_level eq 'Log all status changes');
- $log_level = 7 if ($new_level eq 'Log all events');
- $log_level = 8 if ($new_level eq 'Log all messages');
- }
-
- if ($query->param('ersvp') eq 'Yes') {
- if ($log_level) {
- # Changing logging level
- open (RSVP, "> $config");
- print RSVP "-l $log_level";
- close (RSVP);
- if ($Ersvp eq 'No') {
- system("/sbin/chkconfig", "rsvpd", "on");
- } else {
- system("/sbin/killall", "rsvpd");
- }
- system("/usr/etc/rsvpd", "-l", $log_level);
- $message = "RSVP enabled."
- } elsif ($Ersvp eq 'No') {
- # Just enabling daemon
- system("/sbin/chkconfig", "rsvpd", "on");
- system("/usr/etc/rsvpd");
- $message = "RSVP enabled."
- } else {
- # Was already enabled
- $message = "No changes."
- }
- } else {
- if ($Ersvp eq 'Yes') {
- # Disabling daemon
- system("/sbin/chkconfig", "rsvpd", "off");
- system("/sbin/killall", "rsvpd");
- $message = "RSVP disabled."
- } else {
- # Was already disabled
- $message = "No changes."
- }
- }
- }
-
- &generic;
-
- print $query->end_html;
-
- sub error {
- &error_block($_[0]);
- &generic;
- exit 0;
- }
-
- sub generic {
- &header_block($title);
-
- print "<i>$message</i>";
-
- print "<form name=\"StandardForm\" method=post
- onSubmit=\"return runSubmit()\">";
-
- print "<center><table cellpadding=5 width=450>\n";
-
- print "<tr><th align=left>Enable RSVP:</th><th align=left>\n",
- $query->radio_group(-name=>'ersvp',
- -values=>['Yes','No'], -default=>$Ersvp),
- "</th></tr>\n";
-
- print "<tr><th align=left valign=top>Set logging level:</th>\n",
- "<th align=left>", $query->radio_group(-name=>'log_level',
- -values=>['Log errors only','Also log warnings','Log all
- status changes','Log all events','Log all messages'],
- -default=>$log_err, -linebreak=>'true'),
- "</th></tr>\n";
-
- print "</table></center><br>\n";
-
- print &js_buttons('doit','Ok','onClick="markOK()"','onClick="markOther()"',
- "onClick=\"do_help('$help_page'); return (false)\"");
- print $query->endform;
- }
-
-